<?php
require('../../public/connection.php');
require('../../class/Mysql.php');
$data = (array)json_decode(file_get_contents("php://input", true));
if (empty($data["id"]) || $data["finished"] > 1 || empty($data["title"])) {
    die(json_encode(array("code" => 400, "msg" => "格式错误", "data" => null)));
}
$data["finished"] = (int)$data["finished"];
$edit_one_data = new Mysql();
$result = $edit_one_data->addOrEditData(
    "update todolist set finished={$data["finished"]},title='{$data["title"]}',remarks='{$data["remarks"]}' where id={$data["id"]};"
); 
die(json_encode($result));
